forum

home / developersection / forums / why is char[] preferred over string for passwords?

Why is char[] preferred over String for passwords?

Anonymous User 2006 04-May-2015

In Swing, the password field has a getPassword() (returns char[ ]) method instead of the usual getText() (returns String) method. Similarly, I have come across a suggestion not to use String to handle passwords. Why does String  pose a threat to security when it comes to passwords?

It feels inconvenient to use char[ ].


Updated on 05-May-2015

I am a content writter !


Message
Can you answer this question?

Answer

1 Answers

Liked By